package dao;

import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import pojo.Order;

import java.util.List;

/**
 * @author HLF
 * @date 2022/6/14 16:44
 */
public interface OrderDao {
    @Options(useGeneratedKeys = true, keyProperty = "oid", keyColumn = "oid")
    int insertOrder(Order order);


    List<Order> getAllOrders();

    int deleteByOid(Integer oid);

    int updateOrder(Order order);

    @Select("select * from t_order where oid = #{oid}")
    Order getByOid(Integer oid);

    /**
     * 通过fid查询所有order记录
     */
    @Select("select * from t_order where fid = #{fid}")
    List<Order> getAllOrdersByFid(Integer fid);

    /**
     * 通过uid查询所有order记录
     */
    @Select("select * from t_order where uid = #{uid}")
    List<Order> getAllOrdersByUid(Integer uid);

}
